$(document).ready(function(){
	var url = window.location;
	var BARCODE = cw.common.getQueryString(url,"ID");
	var STATUS = cw.common.getQueryString(url,"STATUS");
	GET_T_FIXED_ASSETS_DETAIL(BARCODE,STATUS);
	cw.common.getUserSession(getUserInfo);
});

function getUserInfo(userinfo){
	$('#CURRENT_USER_NAME').html(userinfo.USER_NAME);
}
//取得资产详细信息
var GET_T_FIXED_ASSETS_DETAIL = function(BARCODE,STATUS){
	if(""==BARCODE||null==BARCODE||undefined==BARCODE)
	{
		alert("请输入或扫描条形码!");
		return;
	}
	var url = cw.common.path + '/json?action=GET_T_FIXED_ASSETS_DETAIL_ACTION&ID='+BARCODE;
	$.post(url,{},function(data){
		if(data.success){
			var vobj=data.root.T_FIXED_ASSETS_DETAIL;
			if(vobj==null||vobj==''||vobj==undefined){
				alert("该资产不存在或已被删除");
				return;
			}
			else{
				var obj = data.root.T_FIXED_ASSETS_DETAIL.rs[0];
				
				cw.common.getValue('FIXED_ASSETS_NAME',obj.FIXED_ASSETS_NAME,'');
				cw.common.getValue('FIXED_ASSETS_NATURE',obj.FIXED_ASSETS_NATURE_NAME,'');
				cw.common.getValue('BRAND',obj.BRAND,'');
				cw.common.getValue('BARCODE',obj.BARCODE,'');
				cw.common.getValue('DEPARTMENT_NO_NAME',obj.DEPARTMENT_NO_NAME,'');
				cw.common.getValue('STOCK_DATE',cw.common.toChar(obj.STOCK_DATE,'yyyy-mm-dd'),'');
				cw.common.getValue('STOCK_PRICE',obj.STOCK_PRICE,'');
				cw.common.getValue('jiner_js',(obj.STOCK_PRICE).toFixed(2),'');
				piliskys((obj.STOCK_PRICE).toFixed(2));
				cw.common.getValue('USE_YEAR',obj.USE_YEAR,'');
				cw.common.getValue('WARRANTY',obj.WARRANTY,'');
				cw.common.getValue('SPECIFICATION',obj.SPECIFICATION,'');
				cw.common.getValue('SUPPLIERS_NO_NAME',obj.SUPPLIERS_NO_NAME,'');
				cw.common.getValue('FACTORY_NO',obj.FACTORY_NO,'');
				cw.common.getValue('STORED_IN',obj.STORED_IN,'');
				cw.common.getValue('WITH_MANANGER_NAME',obj.WITH_MANANGER_NAME,'');
				cw.common.getValue('REMARK',obj.REMARK,'');
				
				
				cw.common.getValue('SUPPLIERS_NO_CONTACT',obj.SUPPLIERS_NO_CONTACT,'');
				cw.common.getValue('SUPPLIERS_NO_ADDRESS',obj.SUPPLIERS_NO_ADDRESS,'');
				cw.common.getValue('SUPPLIERS_NO_ASS_PHONE',obj.SUPPLIERS_NO_ASS_PHONE,'');
				cw.common.getValue('SUPPLIERS_NO_FAX',obj.SUPPLIERS_NO_FAX,'');
				
				cw.common.getValue('DEPARTMENT_NO_NAME',obj.DEPARTMENT_NO_NAME,'');
				cw.common.getValue('GS_DEPARTMENT_NO_NAME',obj.GS_DEPARTMENT_NO_NAME,'');
				cw.common.getValue('CREATE_DATE',cw.common.toChar(obj.CREATE_DATE,'yyyy-MM-dd'),'');
				//cw.common.getValue('WITH_MANANGER_NAME',obj.WITH_MANANGER_NAME,'');
				//cw.common.getValue('REMARK',obj.REMARK,'');
				var datetemp = new Date();
				cw.common.getValue('ck_date',cw.common.toChar(datetemp,'yyyy-MM-dd'),'');
				
				
				//-------------
				if(true){//"3"==STATUS
					$('#spec_pan_not3').hide();
					$('#print_title').html('出库单');
					$('#ID_WITH_MANANGER_NAME').html('使用人');
				}else if("1"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产折旧表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;折旧原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('折旧负责人');
				}else if("2"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产维修表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;维修原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('维修负责人');
				}else if("4"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产领用表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;领用原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('领用人');
				}else if("5"==STATUS){
					$('#spec_pan_not3').show();
					$('#print_title').html('固定资产报废表');
					$('#reason_type_name').html('<b>&nbsp;&nbsp;报废原因：</b>');
					$('#ID_WITH_MANANGER_NAME').html('报废负责人');
				}
							
			}
		}
		else{
			alert(data.errors.errmsg);
		}
	},'json');
}

var shuliang_input_val = 1;
var shuliang_input_sum = 1;
function shuliang_input(){
	$('#shuliang_input_a1').hide();
	$('#shuliang_input_a2').show();
	var valtemp = shuliang_input_val;
	if(""==valtemp || undefined == valtemp) valtemp = 1;
	$('#shuliang_input').html("<input type='input' id='shuliang_input_val' size='5' maxlength=7 value='"+valtemp+"' >");
	
}
function shuliang_input2(){
	var valtemp = $('#shuliang_input_val').val();
	var price = $('#STOCK_PRICE').html();
	if(NaN == parseFloat(valtemp)){
		alert("请输入正确的数量！");
		return false;
	}
	shuliang_input_val = valtemp;
	$('#shuliang_input_a2').hide();
	$('#shuliang_input_a1').show();
	$('#shuliang_input').html(valtemp);
	var jiner_js = (parseFloat(valtemp) * parseFloat(price)).toFixed(2);
	//alert(jiner_js);
	$('#jiner_js').html(jiner_js);
	//alert(jiner_js.toFixed(2));
	piliskys(jiner_js);
}

function piliskys(funval){

//alert(funval);
//var funval= document.all.text1.value;


if(isNaN(funval)) {
	$('#daxie_jiner').html("佰&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;拾&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;万&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;仟&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;佰&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;拾&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;角&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分");
}
else {
shuliang_input_sum = funval;
creat(funval);

}
}
function creat(funval){
//var test1= document.all.text1.value;
var money1 = new Number(funval);
if(money1> 1000000000000000000) {
alert("您输入的数字太大，重新输入！");
return;
}
var monee = Math.round(money1*100).toString(10)
var i,j;
j=0;
var leng = monee.length;
var monval="";
for( i=0;i<leng;i++)
{
monval= monval+to_upper(monee.charAt(i))+to_mon(leng-i-1);
}
repace_acc(monval);
}//欢迎来到站长特效网，我们的网址是www.zzjs.net，很好记，zz站长，js就是js特效，本站收集大量高质量js代码，还有许多广告代码下载。
function to_upper( a)
{
switch(a){
case '0' : return '零'; break;
case '1' : return '壹'; break;
case '2' : return '贰'; break;
case '3' : return '叁'; break;
case '4' : return '肆'; break;
case '5' : return '伍'; break;
case '6' : return '陆'; break;
case '7' : return '柒'; break;
case '8' : return '捌'; break;
case '9' : return '玖'; break;
default: return '' ;
}
}
function to_mon(a){
if(a>10){ a=a - 8;
return(to_mon(a));}
switch(a){
case 0 : return ' 分 '; break;
case 1 : return ' 角 '; break;
case 2 : return ' 元 '; break;
case 3 : return ' 拾 '; break;
case 4 : return ' 佰 '; break;
case 5 : return ' 仟 '; break;
case 6 : return ' 万 '; break;
case 7 : return ' 拾 '; break;
case 8 : return ' 佰 '; break;
case 9 : return ' 仟 '; break;
case 10 : return ' 亿 '; break;
}
}
function repace_acc(Money){
Money=Money.replace("零分","");
Money=Money.replace("零角","零");
var yy;
var outmoney;
outmoney=Money;
yy=0;
while(true){
var lett= outmoney.length;
outmoney= outmoney.replace("零元","元");
outmoney= outmoney.replace("零万","万");
outmoney= outmoney.replace("零亿","亿");
outmoney= outmoney.replace("零仟","零");
outmoney= outmoney.replace("零佰","零");
outmoney= outmoney.replace("零零","零");
outmoney= outmoney.replace("零拾","零");
outmoney= outmoney.replace("亿万","亿零");
outmoney= outmoney.replace("万仟","万零");
outmoney= outmoney.replace("仟佰","仟零");
yy= outmoney.length;
if(yy==lett) break;
}
yy = outmoney.length;
if ( outmoney.charAt(yy-1)=='零'){
outmoney=outmoney.substring(0,yy-1);
}
yy = outmoney.length;
if ( outmoney.charAt(yy-1)=='元'){
	outmoney=outmoney +'整';
}
var sum_temp = shuliang_input_sum+"";
//alert(sum_temp.length);
if(sum_temp.length<5){
	outmoney = "零 拾 "+outmoney;
}
if(sum_temp.length<6){
	outmoney = "零 佰 "+outmoney;
}
if(sum_temp.length<7){
	outmoney = "零 仟 "+outmoney;
}
if(sum_temp.length<8){
	outmoney = "零 万 "+outmoney;
}
if(sum_temp.length<9){
	outmoney = "零 拾 "+outmoney;
}
if(sum_temp.length<10){
	outmoney = "零 佰 "+outmoney;
}
//alert(outmoney);

$('#daxie_jiner').html(outmoney+"￥"+shuliang_input_sum);
}